package com.aspose.cells;

class zie {
   void a(Chart var1, boolean var2, boolean var3) throws Exception {
      if (var1.H() == 1) {
         this.b(var1, var3);
      } else if (var1.H() == 2) {
         this.a(var1, var3);
      } else if (var1.j().n().j()) {
         this.b(var1, var3);
      } else {
         this.a(var1, var3);
      }

   }

   private void a(Chart var1, boolean var2) throws Exception {
      zjo var3 = new zjo((ImageOrPrintOptions)null);

      try {
         zif var4 = null;

         try {
            var4 = var3.c(var1);
            if (var4 == null) {
               return;
            }

            com.aspose.cells.b.a.b.zp var5 = var4.ag();
            com.aspose.cells.b.a.b.zp var6 = var4.B().A();
            if (!var4.U()) {
               var1.getPlotArea().a(var5.c(), var5.d(), var5.e(), var5.f());
            } else {
               var1.getPlotArea().a(var6.c(), var6.d(), var6.e(), var6.f());
            }

            var1.getPlotArea().c(var6.c(), var6.d(), var6.e(), var6.f());
            com.aspose.cells.b.a.b.zp var7 = var4.x().d().A();
            Legend var8 = var1.getLegend();
            var8.a(var7.c(), var7.d(), var7.e(), var7.f());
            this.a(var1, var4);
            this.a((Axis)var1.getValueAxis(), (zafo)var4.E());
            this.a(var1.getCategoryAxis(), var4.f(), var4.S());
            this.a((Axis)var1.getSecondValueAxis(), (zafo)var4.G());
            this.a(var1.getSecondCategoryAxis(), var4.h(), var4.S());
            this.b(var1, var4);
            Title var9 = var1.n();
            if (var9 != null) {
               if (var9.isAutoText() && !"".equals(var4.L().b())) {
                  var9.setText(var4.L().b());
               }

               if (var9.getText() != null && !"".equals(var9.getText())) {
                  com.aspose.cells.b.a.b.zp var10 = var4.K().e().B();
                  var9.b(var10.c(), var10.d(), var10.e(), var10.f());
                  com.aspose.cells.b.a.b.zp var11 = var4.K().e().A();
                  var9.a(var11.c(), var11.d(), var11.e(), var11.f());
                  var9.setX(var11.c());
                  var9.setY(var11.d());
                  var9.k(var4.K().e().a.e());
                  var9.l(var4.K().e().a.f());
               }
            }

            this.a(var1.getNSeries(), var4.z(), var4);
         } finally {
            if (var4 != null && var4.ap() != null) {
               var4.ap().c();
            }

         }
      } finally {
         if (var3 != null) {
            var3.b();
         }

      }

   }

   private void a(Chart var1, zif var2) throws Exception {
      this.a(var1.getCategoryAxis(), var2.e());
      this.a(var1.getSecondCategoryAxis(), var2.g());
      this.a(var1.getValueAxis(), var2.E());
      this.a(var1.getSecondCategoryAxis(), var2.G());
   }

   private void a(Axis var1, zbo var2) throws Exception {
      var1.b(zjm.K(var2.e()));
      Title var3 = var1.n();
      com.aspose.cells.b.a.b.zp var4;
      com.aspose.cells.b.a.b.zp var5;
      com.aspose.cells.b.a.b.zp var6;
      if (var3 != null) {
         if (var3.isAutoText() && !"".equals(var2.L().b())) {
            var3.setText(var2.L().b());
         }

         if (var3.getText() != null && !"".equals(var3.getText())) {
            var4 = var2.K().e().b;
            var5 = new com.aspose.cells.b.a.b.zp(var4.c(), var4.d(), var4.e(), var4.f());
            var5.a(var5.c() * 4000 / var2.c().a());
            var5.b(var5.d() * 4000 / var2.c().b());
            var5.c(var5.e() * 4000 / var2.c().a());
            var5.d(var5.f() * 4000 / var2.c().b());
            var3.b(var5.c(), var5.d(), var5.e(), var5.f());
            var6 = var2.K().e().A();
            var3.a(var6.c(), var6.d(), var6.e(), var6.f());
            var3.setX(var6.c());
            var3.setY(var6.d());
            var3.k(var2.K().e().a.e());
            var3.l(var2.K().e().a.f());
         }
      }

      if (var1.getDisplayUnit() != 0 && var2.Q().d() != 0) {
         var4 = var2.Q().b().b;
         var5 = new com.aspose.cells.b.a.b.zp(var4.c(), var4.d(), var4.e(), var4.f());
         var5.a(var5.c() * 4000 / var2.c().a());
         var5.b(var5.d() * 4000 / var2.c().b());
         var5.c(var5.e() * 4000 / var2.c().a());
         var5.d(var5.f() * 4000 / var2.c().b());
         var1.getDisplayUnitLabel().b(var5.c(), var5.d(), var5.e(), var5.f());
         var6 = var2.Q().b().A();
         var1.getDisplayUnitLabel().a(var6.c(), var6.d(), var6.e(), var6.f());
         var1.getDisplayUnitLabel().k(var2.Q().b().a.e());
      }

   }

   private void b(Chart var1, boolean var2) throws Exception {
      zjo var3 = new zjo((ImageOrPrintOptions)null);

      try {
         zig var4 = null;

         try {
            var4 = var3.d(var1);
            if (var4 != null) {
               com.aspose.cells.b.a.b.zp var5 = var4.ai();
               com.aspose.cells.b.a.b.zp var6 = var4.B().A();
               if (!var4.aa()) {
                  var1.getPlotArea().a(var5.c(), var5.d(), var5.e(), var5.f());
               } else {
                  var1.getPlotArea().a(var6.c(), var6.d(), var6.e(), var6.f());
               }

               var1.getPlotArea().c(var6.c(), var6.d(), var6.e(), var6.f());
               com.aspose.cells.b.a.b.zp var7 = var4.x().c().A();
               Legend var8 = var1.getLegend();
               var8.a(var7.c(), var7.d(), var7.e(), var7.f());
               this.a((Axis)var1.getValueAxis(), (zafo)var4.G());
               this.a(var1.getCategoryAxis(), var4.f(), var4.X());
               this.a((Axis)var1.getSecondValueAxis(), (zafo)var4.I());
               this.a(var1.getSecondCategoryAxis(), var4.h(), var4.X());
               this.a(var1, var4);
               Title var9 = var1.n();
               if (var9 != null) {
                  if (var9.isAutoText() && !"".equals(var4.L().b())) {
                     var9.setText(var4.L().b());
                  }

                  if (var9.getText() != null && !"".equals(var9.getText())) {
                     com.aspose.cells.b.a.b.zp var10 = var4.M().e().B();
                     var9.b(var10.c(), var10.d(), var10.e(), var10.f());
                     com.aspose.cells.b.a.b.zp var11 = var4.M().e().A();
                     var9.a(var11.c(), var11.d(), var11.e(), var11.f());
                     var9.k(var4.M().e().a.e());
                     var9.l(var4.M().e().a.f());
                  }
               }

               this.a(var1.getCategoryAxis(), var4.e());
               this.a(var1.getSecondCategoryAxis(), var4.g());
               this.a(var1.getValueAxis(), var4.G());
               this.a(var1.getSecondValueAxis(), var4.I());
               this.b(var1, var4);
               return;
            }
         } finally {
            if (var4 != null && var4.ap() != null) {
               var4.ap().c();
            }

         }
      } finally {
         if (var3 != null) {
            var3.b();
         }

      }

   }

   private void a(Axis var1, zbp var2) throws Exception {
      var1.b(zjm.K(var2.b()));
      Title var3 = var1.n();
      com.aspose.cells.b.a.b.zp var4;
      com.aspose.cells.b.a.b.zp var5;
      com.aspose.cells.b.a.b.zp var6;
      if (var3 != null) {
         if (var3.isAutoText() && !"".equals(var2.L().b())) {
            var3.setText(var2.L().b());
         }

         if (var3.getText() != null && !"".equals(var3.getText())) {
            var4 = var2.S().e().b;
            var5 = new com.aspose.cells.b.a.b.zp(var4.c(), var4.d(), var4.e(), var4.f());
            var5.a(var5.c() * 4000 / var2.e().a());
            var5.b(var5.d() * 4000 / var2.e().b());
            var5.c(var5.e() * 4000 / var2.e().a());
            var5.d(var5.f() * 4000 / var2.e().b());
            var3.b(var5.c(), var5.d(), var5.e(), var5.f());
            var6 = var2.S().e().A();
            var3.a(var6.c(), var6.d(), var6.e(), var6.f());
            var3.k(var2.S().e().a.e());
            var3.l(var2.S().e().a.f());
         }
      }

      if (var1.getDisplayUnit() != 0 && var2.T().d() != 0) {
         var4 = var2.T().b().b;
         var5 = new com.aspose.cells.b.a.b.zp(var4.c(), var4.d(), var4.e(), var4.f());
         var5.a(var5.c() * 4000 / var2.e().a());
         var5.b(var5.d() * 4000 / var2.e().b());
         var5.c(var5.e() * 4000 / var2.e().a());
         var5.d(var5.f() * 4000 / var2.e().b());
         var1.getDisplayUnitLabel().b(var5.c(), var5.d(), var5.e(), var5.f());
         var6 = var2.T().b().A();
         var1.getDisplayUnitLabel().a(var6.c(), var6.d(), var6.e(), var6.f());
         var1.getDisplayUnitLabel().k(var2.T().b().a.e());
         var1.getDisplayUnitLabel().l(var2.T().b().a.f());
      }

   }

   private void a(Axis var1, zafo var2, boolean var3) {
      if ((var1.getCategoryType() == 0 || var2.k() == 1) && var1.l()) {
         var1.c(var2.H());
      }

      var1.a(var2.x());
      if (var2.k() == 0) {
         var1.b((Object)var2.z());
      } else {
         var1.b((Object)var2.z());
         var1.e(this.a(var2.y()));
         var1.d(this.a(var2.j()));
      }

      var1.b(var2.B());
      if (var2.k() == 0) {
         var1.a((Object)var2.D());
      } else {
         var1.a((Object)var2.D());
         var1.f(this.a(var2.C()));
      }

   }

   private void a(Axis var1, zafo var2) {
      var1.setVisible(var2.q());
      if (var1.g()) {
         var1.a(var2.x());
      }

      if (var1.f()) {
         var1.b((Object)var2.z());
      }

      if (var1.h()) {
         var1.b(var2.B());
      }

      if (var1.e()) {
         var1.a((Object)var2.D());
      }

   }

   private zbcq a(zbcs var1, int var2) {
      if (var1.getCount() == 0) {
         return null;
      } else {
         if (var2 > 0 && var2 <= var1.getCount()) {
            zbcq var3 = var1.c(var2 - 1);
            if (var3.a() == var2) {
               return var3;
            }
         }

         for(int var4 = 0; var4 < var1.getCount(); ++var4) {
            if (var1.a(var4).a() == var2) {
               return (zbcq)var1.a(var4);
            }
         }

         return null;
      }
   }

   private com.aspose.cells.b.a.b.zp a(com.aspose.cells.b.a.b.zp var1, zafz var2) throws Exception {
      com.aspose.cells.b.a.b.zp var3 = com.aspose.cells.b.a.b.zp.a();
      var3.a((int)((double)((float)var1.c() * 4000.0F / (float)var2.a()) + 0.5D));
      var3.b((int)((double)((float)var1.d() * 4000.0F / (float)var2.b()) + 0.5D));
      var3.c((int)((double)((float)var1.e() * 4000.0F / (float)var2.a()) + 0.5D));
      var3.d((int)((double)((float)var1.f() * 4000.0F / (float)var2.b()) + 0.5D));
      return var3;
   }

   private void a(Chart var1, zig var2) {
      if (var2.aa()) {
         Walls var3 = var1.getWalls();
         zbvd var4 = var2.S();
         var3.a(var4.j(), var4.f() - var4.i() / 2.0F, var4.g(), var4.i(), var4.h());
         var3.a(var4.a);
      }

   }

   private void b(Chart var1, zif var2) {
      if (var2.U()) {
         Walls var3 = var1.getWalls();
         zbvc var4 = var2.N();
         var3.a(var4.j(), var4.f() - var4.i() / 2.0F, var4.g(), var4.i(), var4.h());
         var3.a(var4.a);
      }

   }

   private int a(int var1) {
      switch(var1) {
      case 2:
         return 1;
      case 3:
         return 2;
      default:
         return 0;
      }
   }

   private void b(Chart var1, zig var2) throws Exception {
      if (var2 != null) {
         boolean var3 = ChartCollection.b(var1.getType());
         this.a((ChartFrame)var1.getChartArea(), (zix)var2.i(), (Chart)var1);
         this.a((ChartFrame)var1.getPlotArea(), (zix)var2.B(), (Chart)var1);
         this.a((ChartFrame)var1.getLegend(), (zix)var2.x().c(), (Chart)var1);
         if (var1.n() != null) {
            this.a((ChartFrame)var1.getTitle(), (zix)var2.M().e(), (Chart)var1);
         }

         this.b(var1.getCategoryAxis(), var2.e());
         this.b(var1.getSecondCategoryAxis(), var2.g());
         this.b(var1.getValueAxis(), var2.G());
         this.b(var1.getSecondValueAxis(), var2.I());
         this.a(var1.getNSeries(), var2.z(), var2);
         if (var3) {
            if (var1.getPlotArea().getArea().getFormatting() == 0) {
               var1.getPlotArea().getArea().setFormatting(1);
            }

            this.a((Area)var1.getWalls(), (zat)var2.U().d());
            this.a(var1.getWalls().getBorder(), var2.U().c(), var1);
            this.a((Area)var1.getFloor(), (zat)var2.s().c());
            this.a(var1.getFloor().getBorder(), var2.s().a(), var1);
         }

      }
   }

   private void a(ChartFrame var1, zix var2, Chart var3) {
      this.a(var1.getArea(), var2.c());
      this.a(var1.getBorder(), var2.d(), var3);
   }

   private void a(Area var1, zat var2) {
      if (var2.h() == 1) {
         switch(var2.a()) {
         case 8:
         case 9:
         case 10:
         case 12:
         case 13:
            var1.setFormatting(1);
            break;
         case 11:
         default:
            if (var2.f().isEmpty()) {
               var1.setFormatting(1);
            } else {
               var1.setForegroundColor(var2.f());
            }
         }
      }

   }

   private void a(Line var1, zalw var2, Chart var3) {
      if (var1.getFormattingType() == 0) {
         if (var2.a().isEmpty()) {
            var1.n(2);
         } else {
            var1.a(var2.a());
            if (!var1.j() && var2.b().a() != 0.0D) {
               var1.c(var2.b().a() * 72.0D / (double)var3.j().L());
            }
         }
      }

   }

   private void a(Marker var1, zamu var2) {
      if (var1.getMarkerStyle() == 0) {
         var1.a(zjm.d(var2.d()));
      }

      this.a(var1.getArea(), var2.e());
      this.a(var1.getBorder(), var2.f(), var1.h());
   }

   private void b(Axis var1, zbp var2) {
      if (var2.q()) {
         if (var1.n() != null) {
            this.a((ChartFrame)var1.getTitle(), (zix)var2.S().e(), (Chart)var1.a());
            if (var1.getTitle().getArea().getFormatting() == 0) {
               var1.getTitle().getArea().setFormatting(1);
            }
         }

         if (var1.m() != null) {
            this.a((ChartFrame)var1.getDisplayUnitLabel(), (zix)var2.T().b(), (Chart)var1.a());
            if (var1.getDisplayUnitLabel().getArea().getFormatting() == 0) {
               var1.getDisplayUnitLabel().getArea().setFormatting(1);
            }
         }

         this.a(var1.getAxisLine(), var2.l(), var1.a());
         this.a(var1.getMajorGridLines(), var2.w(), var1.a());
         this.a(var1.getMinorGridLines(), var2.w(), var1.a());
      }

   }

   private void a(SeriesCollection var1, zbcs var2, zig var3) throws Exception {
      for(int var4 = 0; var4 < var1.getCount(); ++var4) {
         Series var5 = var1.get(var4);
         zbcq var6 = this.a(var2, var5.a());
         if (var6 != null) {
            var5.b(var6.i());
            if (!var1.isColorVaried()) {
               this.a(var5.getArea(), var6.A());
               this.a(var5.getBorder(), var6.z(), var1.d());
               this.a(var5.getMarker(), var6.B());
            }

            int var7;
            for(var7 = 0; var7 <= var6.k().getCount(); ++var7) {
               if (var1.d().getType() == 49 || var1.d().getType() == 46 || var7 != var6.k().getCount()) {
                  zje var8 = var6.E().b(var7);
                  if (var7 == var6.k().getCount()) {
                     var8 = var6.u();
                  }

                  ChartPoint var9 = var5.getPoints().get(var7);
                  if (var9 != null && var8 != null) {
                     var9.setXValue(var8.s());
                     var9.setYValue(var8.x());
                     var9.a(var8.H().f(), var8.H().g());
                     var9.b(var8.H().h(), var8.H().i());
                     var9.c(var8.I(), var8.J());
                     var9.a(var8.K());
                     var9.a(var8.b, var8.c);
                     var9.a(var8.d);
                     if (var9.g() == null && var9.f() == null && var9.h() == null && ChartCollection.c(var5.getType())) {
                        ;
                     }

                     if (var8.o().c()) {
                        com.aspose.cells.b.a.b.zp var10 = new com.aspose.cells.b.a.b.zp(var8.o().a().b.c(), var8.o().a().b.d(), var8.o().a().b.e(), var8.o().a().b.f());
                        if (var8.o().e()) {
                           var10.a(var10.c() - zpw.a);
                           var10.c(var10.e() + 2 * zpw.a);
                        }

                        var10.b(var10.d() - zpw.a);
                        var10.d(var10.f() + 2 * zpw.a);
                        com.aspose.cells.b.a.b.zp var11 = this.a((com.aspose.cells.b.a.b.zp)var10, (zafz)var3);
                        var9.getDataLabels().b(var11.c(), var11.d(), var11.e(), var11.f());
                        com.aspose.cells.b.a.b.zp var12 = var8.o().a().a;
                        com.aspose.cells.b.a.b.zp var13 = this.a((com.aspose.cells.b.a.b.zp)var12, (zafz)var3);
                        var9.getDataLabels().a(var13.c(), var13.d(), var13.e(), var13.f());
                        var9.getDataLabels().k(var8.o().a().a.e());
                        var9.getDataLabels().l(var8.o().a().a.f());
                     }
                  }
               }
            }

            for(var7 = 0; var7 < var5.getTrendLines().getCount(); ++var7) {
               Trendline var14 = var5.getTrendLines().get(var7);
               zbtu var15 = var6.G().c(var7);
               if (var15 != null) {
                  this.a((Line)var14, (zalw)var15.d(), (Chart)var1.d());
                  if (!"".equals(var15.b().s())) {
                     var14.getDataLabels().a(var15.b().s());
                  }
               }
            }
         }
      }

   }

   private void a(Area var1, zas var2) {
      if (var1.getFormatting() == 0) {
         if (var2.e().isEmpty()) {
            var2.a(0);
         } else {
            var1.setForegroundColor(var2.e());
         }
      }

   }

   private void a(Line var1, zalv var2, Chart var3) {
      if (var1.getFormattingType() == 0) {
         if (var2.a().isEmpty()) {
            var1.n(2);
         } else {
            var1.a(var2.a());
            if (!var1.j() && var2.b().a() != 0.0D) {
               var1.c(var2.b().a() * 72.0D / (double)var3.j().L());
            }
         }
      }

   }

   private void a(Marker var1, zamt var2) {
      if (var1.getMarkerStyle() == 0) {
         var1.a(zjm.d(var2.d()));
      }

      this.a(var1.getArea(), var2.e());
      this.a(var1.getBorder(), var2.f(), var1.h());
   }

   private void a(SeriesCollection var1, zbcr var2, zif var3) throws Exception {
      for(int var4 = 0; var4 < var1.getCount(); ++var4) {
         Series var5 = var1.get(var4);
         zbcp var6 = this.a(var2, var5.a());
         if (var6 != null) {
            var5.b(var6.i());
            if (!var1.isColorVaried()) {
               this.a(var5.getArea(), var6.A());
               this.a(var5.getBorder(), var6.z(), var1.d());
               this.a(var5.getMarker(), var6.B());
            }

            int var7;
            for(var7 = 0; var7 <= var6.D().getCount(); ++var7) {
               if (var1.d().getType() == 49 || var1.d().getType() == 46 || var7 != var6.k().getCount()) {
                  zjd var8 = var6.D().b(var7);
                  if (var7 == var6.k().getCount()) {
                     var8 = var6.u();
                  }

                  ChartPoint var9 = var5.getPoints().get(var7);
                  if (var9 != null && var8 != null) {
                     var9.setXValue(var8.s());
                     var9.setYValue(var8.x());
                     var9.a(var8.I().f(), var8.I().g());
                     var9.b(var8.I().h(), var8.I().i());
                     var9.c(var8.J(), var8.K());
                     var9.a(var8.L());
                     var9.a(var8.b, var8.c);
                     var9.a(var8.d);
                     if (var9.g() != null || var9.f() != null || var9.h() != null) {
                        this.a(var9.getArea(), var8.i());
                        this.a(var9.getBorder(), var8.k(), var1.d());
                        this.a(var9.getMarker(), var8.m());
                     }

                     if (var8.o().c()) {
                        com.aspose.cells.b.a.b.zp var10 = new com.aspose.cells.b.a.b.zp(var8.o().a().b.c(), var8.o().a().b.d(), var8.o().a().b.e(), var8.o().a().b.f());
                        if (var8.o().e()) {
                           var10.a(var10.c() - zpw.a);
                           var10.c(var10.e() + 2 * zpw.a);
                        }

                        var10.b(var10.d() - zpw.a);
                        var10.d(var10.f() + 2 * zpw.a);
                        com.aspose.cells.b.a.b.zp var11 = this.a((com.aspose.cells.b.a.b.zp)var10, (zafz)var3);
                        var9.getDataLabels().b(var11.c(), var11.d(), var11.e(), var11.f());
                        com.aspose.cells.b.a.b.zp var12 = var8.o().a().a;
                        com.aspose.cells.b.a.b.zp var13 = this.a((com.aspose.cells.b.a.b.zp)var12, (zafz)var3);
                        var9.getDataLabels().a(var13.c(), var13.d(), var13.e(), var13.f());
                        var9.getDataLabels().k(var8.o().a().a.e());
                        var9.getDataLabels().l(var8.o().a().a.f());
                     }
                  }
               }
            }

            for(var7 = 0; var7 < var5.getTrendLines().getCount(); ++var7) {
               Trendline var14 = var5.getTrendLines().get(var7);
               zbtt var15 = var6.F().c(var7);
               if (var15 != null) {
                  this.a((Line)var14, (zalv)var15.d(), (Chart)var1.d());
                  if (!"".equals(var15.b().s())) {
                     var14.getDataLabels().a(var15.b().s());
                  }
               }
            }
         }
      }

   }

   private zbcp a(zbcr var1, int var2) {
      if (var2 < var1.getCount()) {
         zbcp var3 = var1.c(var2);
         return var3.a() == var2 ? var3 : this.a(var1, var2, 0, var1.getCount() - 1);
      } else {
         return null;
      }
   }

   private zbcp a(zbcr var1, int var2, int var3, int var4) {
      switch(var4 - var3) {
      case 0:
         zbcp var5 = var1.c(var3);
         if (var2 == var5.ai()) {
            return var5;
         }

         return null;
      case 1:
         zbcp var6 = var1.c(var3);
         zbcp var7 = var1.c(var4);
         if (var2 == var6.ai()) {
            return var6;
         } else {
            if (var2 == var7.ai()) {
               return var7;
            }

            return null;
         }
      default:
         zbcp var8 = var1.c(var3);
         zbcp var9 = var1.c(var4);
         if (var2 > var9.ai()) {
            return null;
         } else if (var2 == var9.ai()) {
            return var9;
         } else if (var2 > var8.ai() && var2 < var9.ai()) {
            int var10 = (var4 + var3) / 2;
            zbcp var11 = var1.c(var10);
            if (var2 > var11.ai()) {
               return var4 - var10 == 1 ? null : this.a(var1, var2, var10 + 1, var4 - 1);
            } else if (var2 == var11.ai()) {
               return var11;
            } else {
               return var10 - var3 == 1 ? null : this.a(var1, var2, var3 + 1, var10 - 1);
            }
         } else {
            return var2 == var8.ai() ? var8 : null;
         }
      }
   }
}
